<br /><br />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />    <title>Editar  Expediente</title>    
</head>
<body>
	<div id="content">
	  <form class="pure-form pure-form-aligned" enctype="application/x-www-form-urlencoded" action="<?php echo $this->url(array('controller'=>'Record',
            'action'=>'edit'));?>" method="post" id = 'form'>
 			
 			<fieldset>
 	           	<legend>Editar Proforma</legend>
    			<div class="pure-g-r">
               		<div class="pure-u-1-2">  
                  		<div class="pure-control-group">
        					<label for="placa" class="required">Placa </label>    
							<?php echo $this->placa; ?>
						</div>	
					</div>
				</div>		
				
			</fieldset>
			<fieldset>
 	           	<legend>Lista Repuestos</legend>
    			
				<table class="pure-table pure-table-bordered" id="piecelist">
		            <thead>
		                <tr>
		                    <th>Cantidad</th>
		                    <th>Descripcion</th>
		                    <th>Precio</th>

		                    
		                    <th style="width: 50px;">&nbsp;</th>
		                </tr>
		            </thead>
		            	
	            	<tbody>
	            		<tr>
	            			<td><input style="box-shadow: inset 0 0 0 #fff;	border: none;" type="text" name="cantidad" value="" id="cantidad" placeholder="Cantidad" /></td>
	            			<td><input style="box-shadow: inset 0 0 0 #fff;	border: none;" type="text" name="descripcion" value="" id="descripcion" placeholder="Descripcion" /></td>
	            			<td><input style="box-shadow: inset 0 0 0 #fff;	border: none;" type="text" name="precio" value="" id="precio" placeholder="Precio" /></td>
	            			<td><input class="pure-button pure-button-primary" type="button" name="button" id="button" value="Agregar" onclick="addPiece()" /></td>
	            		</tr>
		                <?php foreach($this->records as $record) : 
		                	if($this->escape($record["tipo"]) == "R") {
		                ?>
		                	

		                <tr>                   
		                    <td><?php echo $this->escape($record["cantidad"]);?>
		                    	<input type="hidden" name="count[]" value="<?php echo $this->escape($record['cantidad']);?>">
		                    </td>
		                    <td><?php echo $this->escape($record["descripcion"]);?>
		                    	<input type="hidden" name="piecedescription[]" value="<?php echo $this->escape($record['descripcion']);?>">
		                    </td>
		                    <td><?php echo $this->escape($record["precio"]);?>
		                    	<input type="hidden" name="pieceprice[]" value="<?php echo $this->escape($record['precio']);?>">
		                    </td>
		                 	<td><img style="cursor:pointer;" onclick="$(this).parent().parent().remove();" class="delete"/></td>
		                  
		                </tr>

		                  
		                <?php } endforeach; ?>
	            	</tbody>
	            </table>							
			</fieldset>
			<fieldset>
 	           	<legend>Servicios</legend>
    			
				<table class="pure-table pure-table-bordered" id="serviceList">
	            <thead>
	                <tr>
	                    <th>Descripcion</th>
	                    <th>Precio</th>

	                    
	                    <th style="width: 50px;">&nbsp;</th>
	                </tr>
	            </thead>
            	
            	<tbody>
					<tr>
            			<td><input style="box-shadow: inset 0 0 0 #fff;	border: none;" type="text" name="descripcionService" value="" id="descripcionService" placeholder="Descripcion" /></td>
            			<td><input style="box-shadow: inset 0 0 0 #fff;	border: none;" type="text" name="precioService" value="" id="precioService" placeholder="Precio" /></td>
            			<td><input class="pure-button pure-button-primary" type="button" name="button" id="button" value="Agregar" onclick="addService()" /></td>
            		</tr>
	        	 	<?php foreach($this->records as $record) : 
		                	if($this->escape($record["tipo"]) == "S") {
		                ?>
		                	

		                <tr>                   
		                    <td><?php echo $this->escape($record["descripcion"]);?>
								<input type="hidden" name="piecedescriptionService[]" value="<?php echo $this->escape($record['descripcion']);?>">
		                    </td>
		                    <td><?php echo $this->escape($record["precio"]);?>
		                    	<input type="hidden" name="piecepriceService[]" value="<?php echo $this->escape($record['precio']);?>">
		                    </td>
		                 	<td><img style="cursor:pointer;" onclick="$(this).parent().parent().remove();" class="delete"/></td>
		                  
		                </tr>

		                  
		                <?php } endforeach; ?>

                
            	</tbody>
            	</table>
            	<input type="hidden" id="type" name="type">
            	
            	<div class="pure-g-r">
               		<div class="pure-u-1-2">  
                  		<div class="pure-control-group">

			            	<label ></label>
									  <input class="pure-button pure-button-primary" type="submit" name="button" id="proforma" value="Guardar Proforma" onclick="addrecord('P')" />
						</div>		
					</div>	
					<div class="pure-u-1-2">  
                  		<div class="pure-control-group">

			            	<label ></label>
										<input class="pure-button pure-button-primary" type="button" name="button" id="record" value="Guardar Expediente" onclick="addrecord('R')" />		
						</div>		
					</div>	
				
        </div>						
		</fieldset>
		</form>
	</div>
</body>
</html>